# gunicorn.conf.py
import os
import multiprocessing

bind = "0.0.0.0:5000"  # 与 EXPOSE 保持一致
workers = multiprocessing.cpu_count() * 2 + 1
threads = 8
backlog = 2048
worker_class = "gevent"
worker_connections = 1000
max_requests = 1000
daemon = False  # 容器里不要 daemon，否则 PID 1 退出容器就死了
pidfile = "/yolov8/log/gunicorn.pid"
accesslog = "/yolov8/log/access.log"
errorlog = "/yolov8/log/gunicorn.log"
loglevel = "info"

# 确保目录存在
os.makedirs("/yolov8/log", exist_ok=True)
